package com.jing.system.comm.contants;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletConfig;

import com.jing.system.model.Ranking;

/**
 * 榜上有名常用信息的类
 * @author jing.yue
 * @version 1.0
 * @since 2012-09-27
 */
public class RankingCons {

	public static final String ATCOMMENT = "atcomment";
	public static final String COMMENT = "comment";
	public static final String SENIOR = "senior";

	/** at评论第一名的集合 */
	public static List<Ranking> atcommentFirsts = new ArrayList<Ranking>();
	static {
		Ranking ranking = new Ranking(1, 1, "resources/images/ranking/atcomment_1_1.jpg", "@评论第一名的第一种奖励图片，需要妞币3个!", 3);
		atcommentFirsts.add(ranking);
	}
	/** at评论其它名的集合 */
	public static List<Ranking> atcommentOthers = new ArrayList<Ranking>();
	static {
		Ranking ranking = new Ranking(2, 1, "resources/images/ranking/atcomment_2_1.jpg", "@评论其它名次的第一种奖励图片，需要妞币2个!", 2);
		atcommentOthers.add(ranking);
	}

	/** 评论第一名的集合 */
	public static List<Ranking> commentFirsts = new ArrayList<Ranking>();
	static {
		Ranking ranking = new Ranking(1, 1, "resources/images/ranking/comment_1_1.jpg", "评论第一名的第一种奖励图片，需要妞币3个!", 3);
		commentFirsts.add(ranking);
	}
	/** 评论其它名的集合 */
	public static List<Ranking> commentOthers = new ArrayList<Ranking>();
	static {
		Ranking ranking = new Ranking(2, 1, "resources/images/ranking/comment_2_1.jpg", "评论其它名次的第一种奖励图片，需要妞币2个!", 2);
		commentOthers.add(ranking);
	}

	/** 资深第一名的集合 */
	public static List<Ranking> seniorFirsts = new ArrayList<Ranking>();
	static {
		Ranking ranking = new Ranking(1, 1, "resources/images/ranking/senior_1_1.jpg", "资深粉丝第一名的第一种奖励图片，需要妞币3个!", 3);
		seniorFirsts.add(ranking);
	}
	/** 资深其它名的集合 */
	public static List<Ranking> seniorOthers = new ArrayList<Ranking>();
	static {
		Ranking ranking = new Ranking(2, 1, "resources/images/ranking/senior_2_1.jpg", "资深粉丝其它名次的第一种奖励图片，需要妞币2个!", 2);
		seniorOthers.add(ranking);
	}

	/** Ranking的集合[key为: type_grade_gradeImgNo的组合] */
	public static Map<String, Ranking> rankingMaps = new HashMap<String, Ranking>();

	/**
	 * 初始化信息
	 * @param config
	 */
	public static void initRanking(ServletConfig config) {
		for (Ranking ranking : atcommentFirsts) {
			rankingMaps.put(ATCOMMENT + "_" + ranking.getGrade() + "_" + ranking.getGradeImgNo(), ranking);
		}
		for (Ranking ranking : atcommentOthers) {
			rankingMaps.put(ATCOMMENT + "_" + ranking.getGrade() + "_" + ranking.getGradeImgNo(), ranking);
		}

		for (Ranking ranking : commentFirsts) {
			rankingMaps.put(COMMENT + "_" + ranking.getGrade() + "_" + ranking.getGradeImgNo(), ranking);
		}
		for (Ranking ranking : commentOthers) {
			rankingMaps.put(COMMENT + "_" + ranking.getGrade() + "_" + ranking.getGradeImgNo(), ranking);
		}

		for (Ranking ranking : seniorFirsts) {
			rankingMaps.put(SENIOR + "_" + ranking.getGrade() + "_" + ranking.getGradeImgNo(), ranking);
		}
		for (Ranking ranking : seniorOthers) {
			rankingMaps.put(SENIOR + "_" + ranking.getGrade() + "_" + ranking.getGradeImgNo(), ranking);
		}
	}
}